package com.w.wx.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ImageConfig implements WebMvcConfigurer {
    @Value("${web.localurl}")
    private String  fileUrl;

    //url为images/**时项目内没有即static目录下没有，则会去映射的本地的fileUrl找
    public void addResourceHandlers(ResourceHandlerRegistry register){
        register.addResourceHandler("/images/**").addResourceLocations("file:"+fileUrl);
    }


}
